<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>产品详情</title>
		<meta name="keywords" content="Bootstrap模版,Bootstrap模版下载,Bootstrap教程,Bootstrap中文" />
		<meta name="description" content="站长素材提供Bootstrap模版,Bootstrap教程,Bootstrap中文翻译等相关Bootstrap插件下载" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<!-- basic styles -->

		<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
        <link rel="stylesheet"  href="assets/css/kkpager_orange.css" />

		<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

		<!-- page specific plugin styles -->

		<!-- ace styles -->

		<link rel="stylesheet" href="assets/css/ace.min.css" />
		<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="assets/css/ace-skins.min.css" />

		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="assets/js/ace-extra.min.js"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="assets/js/html5shiv.js"></script>
		<script src="assets/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body>
		<#include "header.ftl"/>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>
				<#include "left_list_menu.ftl">
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								产品管理
							</li>
                            <li>
                                <a href="selectServiceProjectList?service_class=1&service_brand=0&service_standard=0&service_assembly=0&service_kind=0&page=1">产品列表</a>
                            </li>
							<li>
								产品详情
							</li>
						</ul><!-- .breadcrumb -->

					</div>

                    <div class="page-content">
                        <div class="page-header">
                            <#--<h1>-->
                                <#--产品管理-->
                                <#--<small>-->
                                    <#--<i class="ace-icon fa fa-angle-double-right"></i>-->
                                    <#--<a href="selectCustomerList?page=1"> 》 产品列表</a>-->
                                <#--</small>-->
                                <#--<small>-->
                                    <#--<i class="ace-icon fa fa-angle-double-right"></i>-->
                                    <#--》 产品详情-->
                                <#--</small>-->
                            <#--</h1>-->
                        </div><!-- /.page-header -->

                        <!-- 客户基本信息 -->
                        <div class="row">
                            <div class="col-xs-12 col-sm-12">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">
                                            基本信息
                                            <button type="button" class="btn btn-primary btn-xs" id="saveServiceProject" style="float: right;margin-top:-6px;"> 保 存 </button>
                                        </h4>
                                    </div>
                                    <div class="panel-body">
                                        <form role="form" id="info" class="form-horizontal">
                                            <div class="form-group">
                                                <input id="service_id" name="service_id" style="display: none" value="${serviceProject.service_id}">
                                                <label class="col-sm-1 control-label">名称 :</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" id="service_name" name="service_name" placeholder=""  value="${serviceProject.service_name !""}" />                                                </div>

                                                <label class="col-sm-2 control-label">型号 :</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" id="service_back" name="service_back" placeholder="" value="${serviceProject.service_back !""}"/>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">原价 :</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" id="service_price" name="service_price" placeholder="" value="${serviceProject.service_price !""}"/>
                                                </div>
                                                <label class="col-sm-2 control-label">维修价格 :</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" id="maintenance_cost" name="maintenance_cost" placeholder="" value="${serviceProject.maintenance_cost !""}"/>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">分类 :</label>
                                                <div class="col-sm-3">
                                                    <select id="service_class_key" >
                                                    <#if serviceProject.service_class == 1>
                                                        <option value="1" selected ="selected">空调</option>
                                                    <#else >
                                                        <option value="1">空调</option>
                                                    </#if>
                                                    <#if serviceProject.service_class == 2>
                                                        <option value="2" selected ="selected">地暖</option>
                                                    <#else >
                                                        <option value="2" >地暖</option>
                                                    </#if>
                                                    <#if serviceProject.service_class == 3>
                                                        <option value="3" selected ="selected">新风</option>
                                                    <#else >
                                                        <option value="3">新风</option>
                                                    </#if>
                                                    <#if serviceProject.service_class == 4>
                                                        <option value="4" selected ="selected">生活热水</option>
                                                    <#else >
                                                        <option value="4">生活热水</option>
                                                    </#if>
                                                    <#if serviceProject.service_class == 5>
                                                        <option value="5" selected ="selected">水处理</option>
                                                    <#else >
                                                        <option value="5">水处理</option>
                                                    </#if>
                                                    <#if serviceProject.service_class == 6>
                                                        <option value="6" selected ="selected">智能家居</option>
                                                    <#else >
                                                        <option value="6">智能家居</option>
                                                    </#if>
                                                    </select>
                                                </div>
                                                <label class="col-sm-2 control-label">种类 :</label>
                                                <div class="col-sm-3">
                                                    <select id="service_kind_key">
                                                        <option value="0">请选择</option>
                                                    <#if serviceProject.service_kind == 1>
                                                        <option value="1" selected="selected">民用</option>
                                                    <#else >
                                                        <option value="1">民用</option>
                                                    </#if>
                                                    <#if serviceProject.service_kind == 2>
                                                        <option value="2" selected="selected">商用</option>
                                                    <#else >
                                                        <option value="2">商用</option>
                                                    </#if>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">品牌 :</label>
                                                <div class="col-sm-3">
                                                    <select id="service_brand_key">
                                                        <option value="0">请选择</option>
                                                        <#list lableInfos as lableList>
                                                            <#if lableList.lable_type == 1>
                                                                <#if serviceProject.service_brand == lableList.lable_id>
                                                                    <option value="${lableList.lable_id}" selected="selected">${lableList.lable_name}</option>
                                                                <#else >
                                                                    <option value="${lableList.lable_id}">${lableList.lable_name}</option>
                                                                </#if>
                                                            </#if>
                                                        </#list>
                                                    </select>
                                                </div>

                                                <label class="col-sm-2 control-label">规格 :</label>
                                                <div class="col-sm-3">
                                                    <select id="service_standard_key">
                                                        <option value="0">请选择</option>
                                                        <#list lableInfos as lableList>
                                                            <#if lableList.lable_type == 2>
                                                                <#if serviceProject.service_standard == lableList.lable_id>
                                                                    <option value="${lableList.lable_id}" selected="selected">${lableList.lable_name}</option>
                                                                <#else >
                                                                    <option value="${lableList.lable_id}">${lableList.lable_name}</option>
                                                                </#if>
                                                            </#if>
                                                        </#list>
                                                    </select>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">部件 :</label>
                                                <div class="col-sm-4">
                                                    <select id="service_assembly_key">
                                                        <option value="0">请选择</option>
                                                        <#list lableInfos as lableList>
                                                            <#if lableList.lable_type == 3>
                                                                <#if serviceProject.service_assembly == lableList.lable_id>
                                                                    <option value="${lableList.lable_id}" selected="selected">${lableList.lable_name}</option>
                                                                <#else >
                                                                    <option value="${lableList.lable_id}">${lableList.lable_name}</option>
                                                                </#if>
                                                            </#if>
                                                        </#list>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">说明 :</label>
                                                <textarea id="service_content" name="service_content" rows="6" cols="100" >${serviceProject.service_content !""}</textarea>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">温馨提示 :</label>
                                                <textarea id="service_msg" name="service_msg" rows="6" cols="100">${serviceProject.service_msg !""}</textarea>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<!-- basic scripts -->


		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
        <script type="text/javascript" src="assets/js/jquery-1.10.2.min.js"></script>
		<script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->

		<script src="assets/js/jquery.dataTables.min.js"></script>
		<script src="assets/js/jquery.dataTables.bootstrap.js"></script>

		<!-- ace scripts -->

		<script src="assets/js/ace-elements.min.js"></script>
		<script src="assets/js/ace.min.js"></script>

        <script type="text/javascript" src="assets/js/kkpager.min.js"></script>

		<!-- inline scripts related to this page -->

                <script src="assets/js/jquery.cookie.js"></script>
                <script type="text/javascript">
                    window.onload=function(){
                        var name = $.cookie('username');
                        if (name == '' || name == null || typeof(name)=="undefined"){
                            document.getElementById("user_name").innerText="unknown user";
                            alert("请先登录");
                            window.location.href='login';
                        }

                        document.getElementById("user_name").innerText=name;
                    }


                    <#--$("#saveCustomerInfo").click(function () {-->
                <#--var customer_id = ${customerInfo.customer_id};-->
                <#--var customer_name = $("input[name='customer_name']").val();-->
                <#--var customer_phone = $("input[name='customer_phone']").val();-->
                <#--var customer_type = $("#customer_type").val();-->

<#--//                alert("customer_id:"+customer_id+",customer_name:"+customer_name+"customer_phone:"+customer_phone+"is_freeze:"+customer_type);-->
                <#--$.ajax({-->
                    <#--type:"POST",-->
                    <#--url:"updateCustomerInfo?",-->
                    <#--data:{"customer_id" : customer_id,"customer_name" : customer_name,"customer_phone" : customer_phone,-->
                    <#--"is_freeze":customer_type},-->
                    <#--dataType:'json',-->
                    <#--success:function(data){-->
                        <#--if(data.status == 200){-->
                            <#--alert("成功！");-->
                            <#--window.location.reload();-->
                        <#--}else{-->
                            <#--alert(data.info);-->
                            <#--return false;-->
                        <#--}-->
                    <#--},-->
                    <#--error: function () {-->
                        <#--alert("服务端出错！");-->
                        <#--return false;-->
                    <#--}-->
                <#--});-->

            <#--})-->

			jQuery(function($) {
				var oTable1 = $('#sample-table-2').dataTable( {
				"aoColumns": [
			      { "bSortable": false },
			      null, null,null, null, null,
				  { "bSortable": false }
				] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
			
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			})


            $("#service_class_key").change(function () {
                var service_name = $("input[name = 'service_name']").val();
                var service_back = $("input[name = 'service_back']").val();
                var service_price = $("input[name = 'service_price']").val();
                var maintenance_cost = $("input[name = 'maintenance_cost']").val();

                var service_class_key = $("#service_class_key").val();
                var StringHref = 'addServiceProjectInit?service_class='+service_class_key;
                if (service_name.trim() != null && service_name.trim() != ''){
                    StringHref = StringHref + '&service_name='+service_name.trim();
                }
                if (service_back.trim() != null && service_back.trim() != ''){
                    StringHref = StringHref + '&service_back='+service_back.trim();
                }
                if (service_price.trim() != null && service_price.trim() != ''){
                    StringHref = StringHref + '&service_price='+service_price.trim();
                }
                if (maintenance_cost.trim() != null && maintenance_cost.trim() != ''){
                    StringHref = StringHref + '&maintenance_cost='+maintenance_cost.trim();
                }
                window.location.href = StringHref;
            })


            $("#saveServiceProject").click(function(){
                var service_id = $("input[name = 'service_id']").val();
                var service_name = $("input[name = 'service_name']").val();
                var service_back = $("input[name = 'service_back']").val();
                var service_price = $("input[name = 'service_price']").val();
                var maintenance_cost = $("input[name = 'maintenance_cost']").val();
                //品牌
                var service_brand_key = $("#service_brand_key").val();
                //规格
                var service_standard_key = $("#service_standard_key").val();
                //部件
                var service_assembly_key = $("#service_assembly_key").val();
                //种类
                var service_kind_key = $("#service_kind_key").val();
                //分类
                var service_class_key = $("#service_class_key").val();

                var service_msg = $("#service_msg").val();
                var service_content = $("#service_content").val();

                if (service_name.trim() == null || service_name.trim() == ''){
                    alert("产品名称不能为空");
                }
                if (service_back.trim() == null || service_back.trim() == ''){
                    alert("型号不能为空");
                }
                if (service_price.trim() == null || service_price.trim() == ''){
                    alert("原价不能为空");
                }
                if (maintenance_cost.trim() == null || maintenance_cost.trim() == ''){
                    alert("维修价不能为空");
                }
                if (service_brand_key == null || service_brand_key == 0){
                    alert("品牌不能为空");
                }
                if (service_standard_key == null || service_standard_key == 0){
                    alert("规格不能为空");
                }
                if (service_assembly_key == null || service_assembly_key == 0){
                    alert("部件不能为空");
                }
                if (service_kind_key == null || service_kind_key == 0){
                    alert("种类不能为空");
                }
                if (service_class_key == null || service_class_key == 0){
                    alert("分类不能为空");
                }

                $.ajax({
                    type:"POST",
                    url:"updateServiceProject?",
                    data:{"service_id":service_id,"service_name" : service_name,"service_back" : service_back,"service_price" : service_price ,
                    "maintenance_cost" : maintenance_cost,"service_class" : service_class_key,"service_kind":service_kind_key,
                    "service_assembly" : service_assembly_key,"service_standard" : service_standard_key,"service_brand" : service_brand_key,
                    "service_msg" : service_msg,"service_content":service_content},
                    dataType:'json',
                    success:function(data){
                        if(data.status == 200){
                            alert("成功！");
                            window.location.reload();
                        }else{
                            alert(data.info);
                            return false;
                        }
                    },
                    error: function () {
                        alert("服务端出错！");
                        return false;
                    }
                });

            })
		</script>
<#--<script type="text/javascript">-->
<#--var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");-->
<#--document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fe9e1d61340ff3d9495a8cca04ebdb49d' type='text/javascript'%3E%3C/script%3E"));-->
<#--</script>-->
<#--<a href="http://www.iteblog.com">过往记忆</a>-->
</body>
</html>
